/**
 *
 */
package br.com.werp.regras.geral.integracao;

import br.com.werp.regras.geral.util.Constantes;
import br.com.werp.regras.geral.util.Util;
import br.com.werp.regras.geral.vos.tabelas.Grau;

import java.sql.Connection;

import java.util.ResourceBundle;


/**
 * @author Italo
 *
 *21/11/2006
 */
public class GrauDependenciaDAO extends MasterDAO {
    private static GrauDependenciaDAO grauDependenciaDAO;

    public GrauDependenciaDAO(String banco) throws Exception {
        super(banco);

        // TODO Auto-generated constructor stub
    }

    public static GrauDependenciaDAO getGrauDependenciaDAO()
        throws Exception {
        if (grauDependenciaDAO == null) {
            ResourceBundle bundle = ResourceBundle.getBundle(Constantes.CONFIG);
            grauDependenciaDAO = new GrauDependenciaDAO(bundle.getString(
                        Constantes.BANCO));
        }

        return grauDependenciaDAO;
    }

    public Grau obterGrau(String grau_id) throws Exception {
        Connection connection = getConexao();

        try {
            Grau grau = new Grau();
            grau.setGrau_id(Util.zeroOuInt(grau_id));

            return (Grau) Util.get0(pesquisarVO(connection, grau));
        } finally {
            liberaConeccao(connection);
        }
    }
}
